package com.zmhc.product.service.impl;

import java.util.List;
import com.zmhc.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zmhc.product.mapper.SpecificationMapper;
import com.zmhc.product.domain.Specification;
import com.zmhc.product.service.ISpecificationService;

/**
 * 商品规格项Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-11
 */
@Service
public class SpecificationServiceImpl implements ISpecificationService 
{
    @Autowired
    private SpecificationMapper specificationMapper;

    /**
     * 查询商品规格项
     * 
     * @param id 商品规格项主键
     * @return 商品规格项
     */
    @Override
    public Specification selectSpecificationById(Long id)
    {
        return specificationMapper.selectSpecificationById(id);
    }

    /**
     * 查询商品规格项列表
     * 
     * @param specification 商品规格项
     * @return 商品规格项
     */
    @Override
    public List<Specification> selectSpecificationList(Specification specification)
    {
        return specificationMapper.selectSpecificationList(specification);
    }

    /**
     * 新增商品规格项
     * 
     * @param specification 商品规格项
     * @return 结果
     */
    @Override
    public int insertSpecification(Specification specification)
    {
        specification.setCreateTime(DateUtils.getNowDate());
        return specificationMapper.insertSpecification(specification);
    }

    /**
     * 修改商品规格项
     * 
     * @param specification 商品规格项
     * @return 结果
     */
    @Override
    public int updateSpecification(Specification specification)
    {
        specification.setUpdateTime(DateUtils.getNowDate());
        return specificationMapper.updateSpecification(specification);
    }

    /**
     * 批量删除商品规格项
     * 
     * @param ids 需要删除的商品规格项主键
     * @return 结果
     */
    @Override
    public int deleteSpecificationByIds(Long[] ids)
    {
        return specificationMapper.deleteSpecificationByIds(ids);
    }

    /**
     * 删除商品规格项信息
     * 
     * @param id 商品规格项主键
     * @return 结果
     */
    @Override
    public int deleteSpecificationById(Long id)
    {
        return specificationMapper.deleteSpecificationById(id);
    }
}
